package com.nineclock.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nineclock.system.pojo.SysCompanyUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface SysCompanyUserMapper extends BaseMapper<SysCompanyUser> {
    /**
     * 接口名称：企业管理: 获取企业当前主管理员
     * 接口路径：GET/sys/company/getCurrentAdmin
     */
    @Select("select cu.* from sys_company_user cu INNER JOIN sys_company_user_role cur \n" +
            "INNER JOIN sys_role r on cu.id = cur.company_user_id and cur.role_id = r.id\n" +
            "where r.company_id = #{companyId} and r.role_name = 'ROLE_ADMIN_SYS'")
    SysCompanyUser queryMainAdminCompanyUser(@Param("companyId") Long companyId);
}
